package web_model

import (
	"github.com/shopspring/decimal"
	"time"

	"gorm.io/gorm"
)

const TableNameTransOrderDetail = "trans_order_detail"

// TransOrderDetail mapped from table <trans_order_detail>
type TransOrderDetail struct {
	ID                int64           `gorm:"column:id;type:INTEGER;primaryKey" json:"id"`
	OrderCode         string          `gorm:"column:order_code;type:TEXT" json:"order_code"`
	OrderLineNum      int64           `gorm:"column:order_line_num;type:INTEGER" json:"order_line_num"`
	ProductName       string          `gorm:"column:product_name;type:TEXT" json:"product_name"`
	ProductCode       string          `gorm:"column:product_code;type:TEXT" json:"product_code"`
	ProductEn         string          `gorm:"column:product_en;type:TEXT" json:"product_en"`
	Formula           string          `gorm:"column:formula;type:TEXT" json:"formula"`
	StorageType       string          `gorm:"column:storage_type;type:TEXT" json:"storage_type"`
	LotNum            string          `gorm:"column:lot_num;type:text" json:"lot_num"`
	ProductDate       string          `gorm:"column:product_date;type:text" json:"product_date"`
	ExpireDate        string          `gorm:"column:expire_date;type:text" json:"expire_date"`
	Count             decimal.Decimal `gorm:"column:count;type:decimal(10,4)" json:"count"`
	Unit              string          `gorm:"column:unit;type:TEXT" json:"unit"`
	Specifications    string          `gorm:"column:specifications;type:TEXT" json:"specifications"`
	Manufacturer      string          `gorm:"column:manufacturer;type:TEXT" json:"manufacturer"`
	ApprovalNum       string          `gorm:"column:approval_num;type:text" json:"approval_num"`
	PermitHolder      string          `gorm:"column:permit_holder;type:TEXT" json:"permit_holder"`
	ApprovalValidTime string          `gorm:"column:approval_valid_time;type:text" json:"approval_valid_time"`
	CreatedAt         time.Time       `gorm:"column:created_at;type:DATETIME" json:"created_at"`
	UpdatedAt         time.Time       `gorm:"column:updated_at;type:DATETIME" json:"updated_at"`
	DeletedAt         gorm.DeletedAt  `gorm:"column:deleted_at;type:DATETIME" json:"deleted_at"`
	CreatedBy         string          `gorm:"column:created_by;type:TEXT" json:"created_by"`
	UpdatedBy         string          `gorm:"column:updated_by;type:text" json:"updated_by"`
}

// TableName TransOrderDetail's table name
func (*TransOrderDetail) TableName() string {
	return TableNameTransOrderDetail
}
